package fanxing.demo05;

/**
 * @author Mr.ma
 * @since 2022/10/25 15:27
 *
 * 泛型方法与其所在类是否采用泛型无关
 **/
public class Test05 {
    public static void main(String[] args) {
        Info info = new Info();
        info.doSome(1);
        info.doSome("hello");
        info.doSome(new Exception("异常类"));

        String sss = info.doOther("sss");
        System.out.println("sss = " + sss);
        Integer integer = info.doOther(123);
        System.out.println("integer = " + integer);
    }
}

class Info{
    public <T> void doSome(T t){
        System.out.println("t = " + t);
    }
    public <T> T doOther(T t){
        System.out.println("t = " + t);
        return t;
    }
}